package com.javabasic.test;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * @Author xiongmin
 * @ClassName 度度熊与数字
 * @Description TODO
 * @Date 2019/8/18 18:09
 * @Version 1.0
 **/
public class 度度熊与数字 {
    static Scanner cin = new Scanner(System.in);

    static PrintWriter printWriter = new PrintWriter(System.out);

    public static void main(String[] args) {
        int t = cin.nextInt();
        ArrayList<Integer> arr = new ArrayList<>();
        int sum = 0, len = 0;
        while (t-- > 0) {
            arr.clear();
            int value = cin.nextInt();
            arr.add(1);
            sum = getSum(value);
            for (int i = 2; i <= sum; i++) {
                if (sum%i == 0 && value%i == 0) {
                    arr.add(i);
                }
            }
            len = arr.size();
            System.out.println(len);
            for (int i = 0; i < len-1; i++) {
                System.out.print(arr.get(i) + " ");
            }
            System.out.println(arr.get(len - 1));
//            printWriter.println(arr.size());
//            for (Integer num :
//                    arr) {
//                printWriter.print(num + " ");
//            }
//            printWriter.println();
//            printWriter.flush();
        }
    }

    private static int getSum(int value) {
        int sum = 0;
        while (value > 0) {
            sum += value%10;
            value /= 10;
        }
        return sum;
    }
}
